package com.duck.base.oauth.security.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import com.duck.sys.entity.User;

public class DuckUserDetails extends User implements UserDetails {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public DuckUserDetails(User user) {
		this.setUserId(user.getUserId());
		this.setUserName(user.getUserAccount());
		this.setUserPassword(user.getUserPassword());
	}

	public DuckUserDetails(String userId, String username, String password, boolean account_enabled,
			boolean account_non_expired, boolean b, boolean account_non_locked,
			Collection<? extends GrantedAuthority> authorities) {
		// TODO Auto-generated constructor stub
		this.setUserId(userId);
		this.setUserName(username);
		this.setUserPassword(password);
	}

	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		List<GrantedAuthority> list = new ArrayList<>();
		return list;
	}

	@Override
	public String getPassword() {
		// TODO Auto-generated method stub
		return this.getUserPassword();
	}

	@Override
	public String getUsername() {
		// TODO Auto-generated method stub
		return this.getUserName();
	}

	@Override
	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return true;
	}

}
